//
//  QLBxOrderCostBotCell.m
//  Xiaomakuaixiu
//
//  Created by 龚碧容 on 2017/10/23.
//  Copyright © 2017年 hwd. All rights reserved.
//

#import "QLBxOrderCostBotCell.h"

@implementation QLBxOrderCostBotCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

+ (instancetype)cellWithTableView:(UITableView *)tableView{
    
    static NSString *identifiew=@"QLBxOrderCostBotCellId";
    QLBxOrderCostBotCell *cell=[tableView dequeueReusableCellWithIdentifier:identifiew];
    if (cell==nil) {
        cell=[[[NSBundle mainBundle] loadNibNamed:@"QLBxOrderCostBotCell" owner:nil options:nil] firstObject];
        
        CGFloat lOrighX1 = 0;
        CGFloat lOrighX2 = 30;
        
        CGFloat lOrighX3 = kScreen_width/2-60;
        
        CGFloat lOrighX4 = kScreen_width-50-40;
        NSArray *hXArray=[NSArray arrayWithObjects:@(lOrighX1),@(lOrighX2),@(lOrighX3),@(lOrighX4), nil];
        NSArray *widthArray=[NSArray arrayWithObjects:@(30),@(kScreen_width/2-30-60),@(kScreen_width/2+30-60),@(50+40), nil];
        
        for (int i=0; i<4; i++) {
            CGFloat tmpOriginX=[hXArray[i] floatValue];
            CGFloat tmpwidth=[widthArray[i] floatValue];
            
            if (i==2) {
                UIView *backView=[[UIView alloc] initWithFrame:CGRectMake(tmpOriginX, 5, 60, 34)];
                backView.backgroundColor=UIColorFromRGB(0xf9f9f9);
                [cell addSubview:backView];
                
                UILabel *aETipLabel=[[UILabel alloc] initWithFrame:CGRectMake(0, 0, 60, 34)];
                aETipLabel.font=[UIFont systemFontOfSize:14];
                aETipLabel.textColor=[UIColor darkGrayColor];
                aETipLabel.backgroundColor=[UIColor clearColor];
                aETipLabel.textAlignment=NSTextAlignmentCenter;
                [backView addSubview:aETipLabel];
                
                cell.extraPriceLabel=aETipLabel;
            }
            
            UILabel *aTipLabel=[[UILabel alloc] initWithFrame:CGRectMake(tmpOriginX, 5, tmpwidth, 34)];
            aTipLabel.font=[UIFont systemFontOfSize:14];
            aTipLabel.textColor=[UIColor darkGrayColor];
            aTipLabel.backgroundColor=[UIColor clearColor];
            aTipLabel.textAlignment=NSTextAlignmentCenter;
            [cell addSubview:aTipLabel];
            
            switch (i) {
                case 0:
                    cell.costidLabel=aTipLabel;
                    break;
                case 1:
                    cell.costNameLabel=aTipLabel;
                    break;
                case 2:
                    cell.costNumLabel=aTipLabel;
                    aTipLabel.textColor=[UIColor lightGrayColor];
                    aTipLabel.textAlignment=NSTextAlignmentCenter;
                    [aTipLabel setFrame:CGRectMake(tmpOriginX+70, 5, tmpwidth-70-10, 34)];
                    break;
                case 3:
                    cell.costPriceLabel=aTipLabel;
                    break;
                default:
                    break;
            }
            
            if (i!=0) {
                UIView *line1=[[UIView alloc] initWithFrame:CGRectMake(tmpOriginX-0.5,0,1,44)];
                line1.backgroundColor=[UIColor lightGrayColor];
                [cell addSubview:line1];
            }
        }
    }
    return cell;
}

@end
